
import Tx from "../../utils/qqmap-wx-jssdk"
import { fileList,willList,priview } from "../../utils/home/index"

// var app=getApp()

var qqmapsdk = new Tx({
  key: 'ESXBZ-STBWG-TETQZ-I32DT-4X4AT-NGB3D' 
});  


Page({

 
 


  data: {
    city:"",
    background: ['demo-text-1', 'demo-text-2', 'demo-text-3','demo-text-4'],
    header:{
      indicatorDots: true,
      vertical:true,
       autoplay: true,
       interval: 2000,
       duration: 500,
    },
    hot:{
      indicatorDots: false,
      vertical:true,
       autoplay: false,
       interval: 2000,
       duration: 500,
      
       
    },
     hot:"",
     will:"",
     pri:""
  },

 
  

  
  onLoad: function (options) {
  
    fileList({
      start:1,
      limit:10
    }).then((res)=>{
      console.log(res);  
      this.setData({
        hot:res.data.data.list
      })
    })

    willList({
      start:2,
      limit:10
    }).then((res)=>{
      console.log(res);  
      this.setData({
        will:res.data.data.list
      })
    })

    priview({
      start:3,
      limit:10
    }).then((res)=>{
      console.log(res);  
      this.setData({
        pri:res.data.data
      })
    })


  },
  


  
  getLocation(){
    var that = this;
    wx.getLocation({
      success(res){
        console.log(res);
        qqmapsdk.reverseGeocoder({
          location: `${res.latitude},${res.longitude}`,
          success(val){
            console.log(val);
            that.setData({
              city:val.result.address_component.city
            })
          }
        });
        qqmapsdk.search({
          keyword:"影院",
          location:`${res.latitude},${res.longitude}`,
          success(result){
            console.log(result);
            
          }
        })
      }
    })
  },

  onShow: function () {
   this.getLocation();
  },

  
  })